﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AutoMapper;
using Microhard.Plat.CompanyChargingMng.Models;
using Microhard.Plat.CompanyChargingMng.DataAccess;

namespace Microhard.Plat.CompanyChargingMng.DTO
{
    public static class FMCGServerMappingExtension
    {
        #region Company
        public static CompanyModel ToModel(this Company entity)
        {
            return Mapper.Map<CompanyModel>(entity);
        }

        public static Company ToEntity(this CompanyModel model)
        {
            return Mapper.Map<Company>(model);
        }
        #endregion

        #region Employee
        public static EmployeeModel ToModel(this Employee entity)
        {
            var model = Mapper.Map<EmployeeModel>(entity);
            model.BelongCompanyName = entity.Company.Name;
            return model;
        }

        public static Employee ToEntity(this EmployeeModel model)
        {
            return Mapper.Map<Employee>(model);
        }
        #endregion
    }
}
